Imports cmplib01
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.Drawing.Drawing2D

Public Class frmChitProperties
    Inherits System.Windows.Forms.Form

    Private ptrGameData As CampaignerGameData
    Private ptrSelectedChit As ChitMember
    Private AsFriendly As Boolean

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents pnlTopBorder As System.Windows.Forms.Panel
    Friend WithEvents picCampaignerIcon As System.Windows.Forms.PictureBox
    Friend WithEvents txtTitleBox As System.Windows.Forms.TextBox
    Friend WithEvents pnlFactionOneProperties As System.Windows.Forms.Panel
    Friend WithEvents btnOK As System.Windows.Forms.Button
    Friend WithEvents lblOwningPlayer As System.Windows.Forms.Label
    Friend WithEvents txtOwningPlayerName As System.Windows.Forms.TextBox
    Friend WithEvents lblOrders As System.Windows.Forms.Label
    Friend WithEvents txtOrders As System.Windows.Forms.TextBox
    Friend WithEvents lblStatus As System.Windows.Forms.Label
    Friend WithEvents txtStatus As System.Windows.Forms.TextBox
    Friend WithEvents lblChitName As System.Windows.Forms.Label
    Friend WithEvents picRemainingStrength As System.Windows.Forms.PictureBox
    Friend WithEvents lblCombatStrength As System.Windows.Forms.Label
    Friend WithEvents lblRemainingStrength As System.Windows.Forms.Label
    Friend WithEvents picCombatStrength As System.Windows.Forms.PictureBox
    Friend WithEvents lblMaxPointValue As System.Windows.Forms.Label
    Friend WithEvents txtMaxPointValue As System.Windows.Forms.TextBox
    Friend WithEvents txtChitName As System.Windows.Forms.TextBox
    Friend WithEvents lblChitType As System.Windows.Forms.Label
    Friend WithEvents txtChitType As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmChitProperties))
        Me.pnlTopBorder = New System.Windows.Forms.Panel
        Me.picCampaignerIcon = New System.Windows.Forms.PictureBox
        Me.txtTitleBox = New System.Windows.Forms.TextBox
        Me.pnlFactionOneProperties = New System.Windows.Forms.Panel
        Me.txtChitType = New System.Windows.Forms.TextBox
        Me.lblMaxPointValue = New System.Windows.Forms.Label
        Me.txtMaxPointValue = New System.Windows.Forms.TextBox
        Me.picCombatStrength = New System.Windows.Forms.PictureBox
        Me.lblStatus = New System.Windows.Forms.Label
        Me.txtStatus = New System.Windows.Forms.TextBox
        Me.txtOrders = New System.Windows.Forms.TextBox
        Me.picRemainingStrength = New System.Windows.Forms.PictureBox
        Me.lblCombatStrength = New System.Windows.Forms.Label
        Me.lblRemainingStrength = New System.Windows.Forms.Label
        Me.lblOwningPlayer = New System.Windows.Forms.Label
        Me.txtOwningPlayerName = New System.Windows.Forms.TextBox
        Me.txtChitName = New System.Windows.Forms.TextBox
        Me.lblChitName = New System.Windows.Forms.Label
        Me.lblChitType = New System.Windows.Forms.Label
        Me.lblOrders = New System.Windows.Forms.Label
        Me.btnOK = New System.Windows.Forms.Button
        Me.pnlTopBorder.SuspendLayout()
        Me.pnlFactionOneProperties.SuspendLayout()
        Me.SuspendLayout()
        '
        'pnlTopBorder
        '
        Me.pnlTopBorder.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.pnlTopBorder.BackColor = System.Drawing.Color.SteelBlue
        Me.pnlTopBorder.Controls.Add(Me.picCampaignerIcon)
        Me.pnlTopBorder.Controls.Add(Me.txtTitleBox)
        Me.pnlTopBorder.Location = New System.Drawing.Point(0, 0)
        Me.pnlTopBorder.Name = "pnlTopBorder"
        Me.pnlTopBorder.Size = New System.Drawing.Size(288, 40)
        Me.pnlTopBorder.TabIndex = 16
        '
        'picCampaignerIcon
        '
        Me.picCampaignerIcon.Image = CType(resources.GetObject("picCampaignerIcon.Image"), System.Drawing.Image)
        Me.picCampaignerIcon.Location = New System.Drawing.Point(6, 3)
        Me.picCampaignerIcon.Name = "picCampaignerIcon"
        Me.picCampaignerIcon.Size = New System.Drawing.Size(34, 34)
        Me.picCampaignerIcon.TabIndex = 9
        Me.picCampaignerIcon.TabStop = False
        '
        'txtTitleBox
        '
        Me.txtTitleBox.BackColor = System.Drawing.Color.SteelBlue
        Me.txtTitleBox.BorderStyle = System.Windows.Forms.BorderStyle.None
        Me.txtTitleBox.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtTitleBox.ForeColor = System.Drawing.Color.WhiteSmoke
        Me.txtTitleBox.Location = New System.Drawing.Point(48, 8)
        Me.txtTitleBox.Multiline = True
        Me.txtTitleBox.Name = "txtTitleBox"
        Me.txtTitleBox.ReadOnly = True
        Me.txtTitleBox.Size = New System.Drawing.Size(240, 26)
        Me.txtTitleBox.TabIndex = 8
        Me.txtTitleBox.TabStop = False
        Me.txtTitleBox.Text = "Enemy Chit"
        '
        'pnlFactionOneProperties
        '
        Me.pnlFactionOneProperties.BackColor = System.Drawing.Color.LightSteelBlue
        Me.pnlFactionOneProperties.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.pnlFactionOneProperties.Controls.Add(Me.txtChitType)
        Me.pnlFactionOneProperties.Controls.Add(Me.lblMaxPointValue)
        Me.pnlFactionOneProperties.Controls.Add(Me.txtMaxPointValue)
        Me.pnlFactionOneProperties.Controls.Add(Me.picCombatStrength)
        Me.pnlFactionOneProperties.Controls.Add(Me.lblStatus)
        Me.pnlFactionOneProperties.Controls.Add(Me.txtStatus)
        Me.pnlFactionOneProperties.Controls.Add(Me.txtOrders)
        Me.pnlFactionOneProperties.Controls.Add(Me.picRemainingStrength)
        Me.pnlFactionOneProperties.Controls.Add(Me.lblCombatStrength)
        Me.pnlFactionOneProperties.Controls.Add(Me.lblRemainingStrength)
        Me.pnlFactionOneProperties.Controls.Add(Me.lblOwningPlayer)
        Me.pnlFactionOneProperties.Controls.Add(Me.txtOwningPlayerName)
        Me.pnlFactionOneProperties.Controls.Add(Me.txtChitName)
        Me.pnlFactionOneProperties.Controls.Add(Me.lblChitName)
        Me.pnlFactionOneProperties.Controls.Add(Me.lblChitType)
        Me.pnlFactionOneProperties.Controls.Add(Me.lblOrders)
        Me.pnlFactionOneProperties.Location = New System.Drawing.Point(8, 48)
        Me.pnlFactionOneProperties.Name = "pnlFactionOneProperties"
        Me.pnlFactionOneProperties.Size = New System.Drawing.Size(272, 368)
        Me.pnlFactionOneProperties.TabIndex = 15
        '
        'txtChitType
        '
        Me.txtChitType.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtChitType.Location = New System.Drawing.Point(32, 216)
        Me.txtChitType.Name = "txtChitType"
        Me.txtChitType.ReadOnly = True
        Me.txtChitType.Size = New System.Drawing.Size(232, 21)
        Me.txtChitType.TabIndex = 19
        Me.txtChitType.TabStop = False
        Me.txtChitType.Text = "Unknown"
        Me.txtChitType.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        '
        'lblMaxPointValue
        '
        Me.lblMaxPointValue.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblMaxPointValue.Location = New System.Drawing.Point(16, 320)
        Me.lblMaxPointValue.Name = "lblMaxPointValue"
        Me.lblMaxPointValue.Size = New System.Drawing.Size(120, 16)
        Me.lblMaxPointValue.TabIndex = 18
        Me.lblMaxPointValue.Text = "Max Point Value"
        '
        'txtMaxPointValue
        '
        Me.txtMaxPointValue.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtMaxPointValue.Location = New System.Drawing.Point(32, 336)
        Me.txtMaxPointValue.Name = "txtMaxPointValue"
        Me.txtMaxPointValue.ReadOnly = True
        Me.txtMaxPointValue.Size = New System.Drawing.Size(232, 21)
        Me.txtMaxPointValue.TabIndex = 17
        Me.txtMaxPointValue.TabStop = False
        Me.txtMaxPointValue.Text = "Unknown"
        Me.txtMaxPointValue.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        '
        'picCombatStrength
        '
        Me.picCombatStrength.BackColor = System.Drawing.Color.Silver
        Me.picCombatStrength.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.picCombatStrength.Location = New System.Drawing.Point(32, 176)
        Me.picCombatStrength.Name = "picCombatStrength"
        Me.picCombatStrength.Size = New System.Drawing.Size(232, 20)
        Me.picCombatStrength.TabIndex = 16
        Me.picCombatStrength.TabStop = False
        '
        'lblStatus
        '
        Me.lblStatus.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblStatus.Location = New System.Drawing.Point(16, 280)
        Me.lblStatus.Name = "lblStatus"
        Me.lblStatus.Size = New System.Drawing.Size(97, 14)
        Me.lblStatus.TabIndex = 13
        Me.lblStatus.Text = "Status"
        '
        'txtStatus
        '
        Me.txtStatus.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtStatus.Location = New System.Drawing.Point(32, 296)
        Me.txtStatus.Name = "txtStatus"
        Me.txtStatus.ReadOnly = True
        Me.txtStatus.Size = New System.Drawing.Size(232, 21)
        Me.txtStatus.TabIndex = 12
        Me.txtStatus.TabStop = False
        Me.txtStatus.Text = "Unknown"
        Me.txtStatus.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        '
        'txtOrders
        '
        Me.txtOrders.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtOrders.Location = New System.Drawing.Point(32, 256)
        Me.txtOrders.Name = "txtOrders"
        Me.txtOrders.ReadOnly = True
        Me.txtOrders.Size = New System.Drawing.Size(232, 21)
        Me.txtOrders.TabIndex = 10
        Me.txtOrders.TabStop = False
        Me.txtOrders.Text = "Unknown"
        Me.txtOrders.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        '
        'picRemainingStrength
        '
        Me.picRemainingStrength.BackColor = System.Drawing.Color.Silver
        Me.picRemainingStrength.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.picRemainingStrength.Location = New System.Drawing.Point(32, 136)
        Me.picRemainingStrength.Name = "picRemainingStrength"
        Me.picRemainingStrength.Size = New System.Drawing.Size(232, 20)
        Me.picRemainingStrength.TabIndex = 9
        Me.picRemainingStrength.TabStop = False
        '
        'lblCombatStrength
        '
        Me.lblCombatStrength.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblCombatStrength.Location = New System.Drawing.Point(16, 160)
        Me.lblCombatStrength.Name = "lblCombatStrength"
        Me.lblCombatStrength.Size = New System.Drawing.Size(128, 16)
        Me.lblCombatStrength.TabIndex = 6
        Me.lblCombatStrength.Text = "Combat Strength"
        '
        'lblRemainingStrength
        '
        Me.lblRemainingStrength.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblRemainingStrength.Location = New System.Drawing.Point(16, 120)
        Me.lblRemainingStrength.Name = "lblRemainingStrength"
        Me.lblRemainingStrength.Size = New System.Drawing.Size(128, 16)
        Me.lblRemainingStrength.TabIndex = 4
        Me.lblRemainingStrength.Text = "Remaining Strength"
        '
        'lblOwningPlayer
        '
        Me.lblOwningPlayer.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblOwningPlayer.Location = New System.Drawing.Point(16, 8)
        Me.lblOwningPlayer.Name = "lblOwningPlayer"
        Me.lblOwningPlayer.Size = New System.Drawing.Size(168, 24)
        Me.lblOwningPlayer.TabIndex = 3
        Me.lblOwningPlayer.Text = "Owning Player"
        '
        'txtOwningPlayerName
        '
        Me.txtOwningPlayerName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtOwningPlayerName.Location = New System.Drawing.Point(16, 32)
        Me.txtOwningPlayerName.Name = "txtOwningPlayerName"
        Me.txtOwningPlayerName.ReadOnly = True
        Me.txtOwningPlayerName.Size = New System.Drawing.Size(248, 21)
        Me.txtOwningPlayerName.TabIndex = 0
        Me.txtOwningPlayerName.TabStop = False
        Me.txtOwningPlayerName.Text = "Unknown"
        Me.txtOwningPlayerName.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        '
        'txtChitName
        '
        Me.txtChitName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtChitName.Location = New System.Drawing.Point(16, 88)
        Me.txtChitName.Name = "txtChitName"
        Me.txtChitName.ReadOnly = True
        Me.txtChitName.Size = New System.Drawing.Size(248, 21)
        Me.txtChitName.TabIndex = 14
        Me.txtChitName.TabStop = False
        Me.txtChitName.Text = "Unknown"
        Me.txtChitName.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        '
        'lblChitName
        '
        Me.lblChitName.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblChitName.Location = New System.Drawing.Point(16, 64)
        Me.lblChitName.Name = "lblChitName"
        Me.lblChitName.Size = New System.Drawing.Size(97, 24)
        Me.lblChitName.TabIndex = 15
        Me.lblChitName.Text = "Chit Name"
        '
        'lblChitType
        '
        Me.lblChitType.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblChitType.Location = New System.Drawing.Point(16, 200)
        Me.lblChitType.Name = "lblChitType"
        Me.lblChitType.Size = New System.Drawing.Size(97, 16)
        Me.lblChitType.TabIndex = 20
        Me.lblChitType.Text = "Chit Type"
        '
        'lblOrders
        '
        Me.lblOrders.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblOrders.Location = New System.Drawing.Point(16, 240)
        Me.lblOrders.Name = "lblOrders"
        Me.lblOrders.Size = New System.Drawing.Size(97, 19)
        Me.lblOrders.TabIndex = 11
        Me.lblOrders.Text = "Orders"
        '
        'btnOK
        '
        Me.btnOK.BackColor = System.Drawing.Color.LightSteelBlue
        Me.btnOK.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.btnOK.Location = New System.Drawing.Point(200, 424)
        Me.btnOK.Name = "btnOK"
        Me.btnOK.TabIndex = 17
        Me.btnOK.Text = "OK"
        '
        'frmChitProperties
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.BackColor = System.Drawing.Color.Black
        Me.ClientSize = New System.Drawing.Size(288, 454)
        Me.ControlBox = False
        Me.Controls.Add(Me.btnOK)
        Me.Controls.Add(Me.pnlTopBorder)
        Me.Controls.Add(Me.pnlFactionOneProperties)
        Me.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
        Me.Name = "frmChitProperties"
        Me.ShowInTaskbar = False
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
        Me.pnlTopBorder.ResumeLayout(False)
        Me.pnlFactionOneProperties.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region


    Public Sub New(ByVal SelectedChit As ChitMember, ByVal DetectionLevel As cmplib01.CampaignerGameData.ChitDetectionLevel, ByRef GameData As cmplib01.CampaignerGameData, Optional ByVal Friendly As Boolean = False)
        Me.New()

        AsFriendly = Friendly

        ptrGameData = GameData
        ptrSelectedChit = SelectedChit
        ListData(DetectionLevel)

    End Sub

    Private Sub ListData(ByVal Detect As cmplib01.CampaignerGameData.ChitDetectionLevel)
        'determine what values should be shown depending on the available information

        Select Case Detect
            Case Is <= cmplib01.CampaignerGameData.ChitDetectionLevel.DetectedDL
                ' this is a question mark, so no info should be shown
                ' basically, we just don't fill in any info. Ahahaha!!!
                OwningPlayer()
            Case Is <= cmplib01.CampaignerGameData.ChitDetectionLevel.SightedDL
                ' owning player, remaining strength, icon, combat str
                OwningPlayer()
                RemainingStrength()
                ShowIcon()
                CombatStrength()
                ChitType()
            Case Is <= cmplib01.CampaignerGameData.ChitDetectionLevel.IdentifiedDL
                ' owning player, remaining str, combat str, initial pv
                OwningPlayer()
                RemainingStrength()
                ShowIcon()
                CombatStrength()
                InitialPV()
                ChitName()
                ChitType()
            Case Is >= cmplib01.CampaignerGameData.ChitDetectionLevel.KnownDL
                ' owning player, remaining str, combat str, initial pv, orders, status
                OwningPlayer()
                RemainingStrength()
                ShowIcon()
                CombatStrength()
                InitialPV()
                Orders()
                Status()
                ChitName()
                ChitType()
        End Select

    End Sub

    Private Sub ChitType()
        Try

            Select Case ptrSelectedChit.UnitType
                Case GroundChitClass_cgd.Objective
                    txtChitType.Text = DirectCast(ptrSelectedChit, InstallationChit).ptrInstallation.TypeName
                Case GroundChitClass_cgd.Battlegroup
                    txtChitType.Text = "Battlegroup"
            End Select

            'If TypeOf ptrSelectedChit Is BattlegroupChit Then
            'txtChitType.Text = "Battlegroup"
            '    Exit Sub
            'End If
            'txtChitType.Text = ptrSelectedChit.Name

            'If txtChitType.Text = "" Then
            '    If TypeOf ptrSelectedChit Is UnitType Then
            '        txtChitType.Text = ptrGameData.UnitTypes.Item(CampaignerGameData.CDGKEY_UNITTYPE & ptrSelectedChit.TypeID)
            '    ElseIf TypeOf ptrSelectedChit Is BattleGroup Then
            '        txtChitType.Text = "Battlegroup"
            '    ElseIf TypeOf ptrSelectedChit Is ObjectiveType Then
            '        txtChitType.Text = ptrGameData.UnitTypes.Item(CampaignerGameData.CGDKEY_OBJECTIVETYPE & ptrSelectedChit.TypeID)
            '    End If
            'End If
        Catch ex As Exception
            HandleException(Me.Name, ex)
        End Try
    End Sub

    Private Sub OwningPlayer()
        Dim play As New Player
        Dim playKey As String

        If ptrSelectedChit.UnitType = GroundChitClass_cgd.Objective Then
            'fact = ptrGameData.Faction_g.Item(CampaignerGameData.CDGKEY_FACTION & ptrSelectedChit.OwningFaction)
            txtOwningPlayerName.Text = ptrSelectedChit.OwningFaction.FactionName 'fact.FactionName
        Else
            Try
                txtOwningPlayerName.Text = ptrSelectedChit.OwningPlayer.PlayerName
                'For Each playKey In ptrGameData.Players.Keys
                '    play = ptrGameData.Players.Item(playKey)
                '    If play.PlayerID = ptrSelectedChit.OwningPlayer Then
                '        txtOwningPlayerName.Text = play.PlayerName
                '    End If
                'Next

            Catch ex As Exception
                txtOwningPlayerName.Text = "Error Finding Name"
            End Try
        End If


    End Sub

    Private Sub ChitName()
        txtChitName.Text = ptrSelectedChit.Name
    End Sub

    Private Sub RemainingStrength()
        Try

            If ptrSelectedChit.UnitType = GroundChitClass_cgd.Objective Then Exit Sub

            Dim remStrength As Single
            Dim batt As BattlegroupChit = DirectCast(ptrSelectedChit, BattlegroupChit)

            remStrength = batt.CurrentPV / batt.deployedpointvalue

            Dim nSize As Integer = picRemainingStrength.Width

            Dim bar As New RectangleF(2, 2, (nSize * remStrength) - 6, 14)

            Dim im As Image = New Bitmap(nSize, 20)
            Dim g As Graphics = Graphics.FromImage(im)

            Dim br As New LinearGradientBrush(bar, Color.Red, Color.Green, LinearGradientMode.Horizontal, 0.63)
            g.FillRectangle(br, bar)

            picRemainingStrength.Image = im
            br.Dispose()
            g.Dispose()

        Catch ex As Exception
            HandleException(c_Module, ex)
        End Try

    End Sub

    Private Sub ShowIcon()
        If AsFriendly = True Then
            picCampaignerIcon.Image = ptrSelectedChit.icon
            txtTitleBox.Text = "Friendly Chit"
        Else
            picCampaignerIcon.Image = ptrSelectedChit.icon
        End If

    End Sub

    Private Sub CombatStrength()
        Try

            If ptrSelectedChit.UnitType = GroundChitClass_cgd.Objective Then Exit Sub

            Dim comStrength As Single
            Dim batt As BattlegroupChit = DirectCast(ptrSelectedChit, BattlegroupChit)
            If ptrGameData.MaxPointValueDeployed = 0 Then
                '// we need to calculate it then
                ptrGameData.calculateMaxDeployedPV()
            End If

            comStrength = batt.deployedpointvalue / ptrGameData.MaxPointValueDeployed

            Dim bar As New RectangleF(2, 2, (232 * comStrength) - 6, 14)

            Dim imCom As Image = New Bitmap(232, 20)
            Dim g As Graphics = Graphics.FromImage(imCom)

            Dim br As New LinearGradientBrush(bar, Color.Red, Color.Green, LinearGradientMode.Horizontal)

            g.FillRectangle(br, bar)

            picCombatStrength.Image = imCom

            g.Dispose()
        Catch ex As Exception
            HandleException(c_Module, ex)
        End Try
    End Sub

    Private Sub InitialPV()
        Try
            If ptrSelectedChit.UnitType = GroundChitClass_cgd.Objective Then Exit Sub

            txtMaxPointValue.Text = DirectCast(ptrSelectedChit, BattlegroupChit).deployedpointvalue
        Catch ex As Exception
            HandleException(c_Module, ex)
        End Try
    End Sub

    Private Sub Orders()
        Try
            If ptrSelectedChit.UnitType = GroundChitClass_cgd.Objective Then Exit Sub

            If ptrSelectedChit.UnitType = GroundChitClass_cgd.Battlegroup Then
                Dim unit As BattlegroupChit
                unit = ptrSelectedChit
                txtOrders.Text = unit.order
            Else
                txtOrders.Text = "Not Applicable"
            End If
        Catch ex As Exception
            HandleException(c_Module, ex)
        End Try

    End Sub

    Private Sub Status()
        txtStatus.Text = ptrSelectedChit.Status.ToString
    End Sub

    Private Sub picRemainingStrength_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles picRemainingStrength.Click
        RemainingStrength()
    End Sub

    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
        Me.Hide()
    End Sub
End Class



'    UnaccountedDL = 0
'    UndetectedDL = 1
'    DetectedDL = 2
'    SightedDL = 4
'    IdentifiedDL = 8
'    KnownDL = 12
